package com.liy.cloud.common.yy.service.impl;

import com.liy.cloud.common.yy.dao.YyTicketDetailDao;
import com.liy.cloud.common.yy.entity.YyTicketDetail;
import com.das.framework.common.utils.Tools;
import com.liy.cloud.common.yy.service.YyTicketMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.liy.cloud.common.yy.dao.YyTicketMainDao;
import com.liy.cloud.common.yy.entity.YyTicketMain;
import com.das.framework.common.dao.IBaseDao;
import com.das.framework.common.service.impl.BaseServiceImpl;

import java.util.List;

/**
 * 设备票箱信息主表 Service接口服务实现
 * @ClassName: YyTicketMainServiceImpl
 * @Description: 
 * @author libs
 * @date: 2018-08-15 20:28:56
 */
@Service
public class YyTicketMainServiceImpl extends BaseServiceImpl<YyTicketMain, String> implements YyTicketMainService {

  @Autowired
  private YyTicketMainDao yyticketmainDao;
  @Autowired
  private YyTicketDetailDao yyTicketDetailDao;
  
  @Override
  public IBaseDao<YyTicketMain, String> getDao() {
    return yyticketmainDao;
  }

  @Override
  public void saveTicketDevice(YyTicketMain yyTicketMainEntity, List<YyTicketDetail> yyTicketDetailList) throws Exception{
    yyticketmainDao.insertSelective(yyTicketMainEntity);
    if(!Tools.listIsNullOrEmpty(yyTicketDetailList)){
      for(YyTicketDetail yyTicketDetailEntity: yyTicketDetailList){
        yyTicketDetailDao.insertSelective(yyTicketDetailEntity);
      }
    }

  }

  @Override
  public void updateSign(YyTicketMain yyTicketMainEntity) {
    yyticketmainDao.updateSign(yyTicketMainEntity);
  }

}            